﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using ATA.OLSD.ScoringService.Entities;

namespace CPAScoringPerformanceTester.TestTask
{
    class UserLoginTask : TestTaskBase
    {
        private string username;
        private string password;
        public static string TaskName = "User Login Test";
        public UserAccessTicket Ticket { get; private set; }

        public UserLoginTask(string username, string password)
        {
            this.username = username;
            this.password = password;
        }

        public override bool Execute()
        {
            try
            {
                Client = ServiceProxy.NewProxy();
                Ticket = Client.Login(username, password);
                return Ticket != null;
            }
            catch (Exception ex)
            {
                Message = ex.Message;
                return false;
            }
            finally
            {
                Client.CloseConnection();
            }
        }
    }
}
